const htpp = require('http');
const server = htpp.createServer();
server.on('request',(req,res)=>{
  const url = req.url;
  let content = '404 not Found';
  if(url === '/' || url === '/index.html'){
    content = '首页';
  }else if(url === '/about.html'){
    content = '<h1>about 页面</h1>'
  }

  res.setHeader('Content-type','text/html;charset=utf-8')
  res.end(content)
})

server.listen('8080',()=>{
  console.log('server run at http://127.0.0.1')
})